﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class exam2_card : MonoBehaviour
{
    public GameObject boomFx;
    // Start is called before the first frame update
    void Start()
    {
        
    }

    // Update is called once per frame
    void Update()
    {
        transform.Rotate(Vector3.up * 45 * Time.deltaTime);
    }

    private void OnTriggerEnter(Collider other)
    {
        if(other.tag.Equals("Player"))
        {
            var getBag = other.GetComponent<exame2_bag>();
            if (getBag!=null)
            {
                getBag.isHadCard = true;
                if(boomFx!=null)
                {
                    Destroy(Instantiate(boomFx, transform.position, transform.rotation), 3f);
                }
                Destroy(gameObject);
            }
        }
    }
}
